home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Action 72 - Disc 2
/
cdaction-72-2.iso
/
#bonus
/
Action Mag_23.exe
/
DATA
/
engine.js
< prev
next >
Wrap
Text File
|
2001-09-07
|
5KB
|
129 lines
//sprawdza czy zosta│o podane has│o do wyszukania
function check(ok)
{
if (ok == 'nie')
{
if (document.find.what.value != "")
{
znajdz();
} else {
error('Nie podano wyszukiwanego has│a.');
}
}
}
//G│≤wna funkcja engine'u AMSE
wynik = new Array();
function znajdz()//bylo (tryb)
{
y=1;
haslo_orginal = document.find.what.value;
haslo = haslo_orginal.toLowerCase();
//rozdzielaenia na autora i
for (x = 1; x <= (dane.length-1); x ++)
{
if ((document.find.opc_1.checked == true)&&(document.find.opc_2.checked == false))
{
//wyszukiwanie wg autorow artow
if (dane[x].autor.toLowerCase().indexOf(haslo) != -1)
{
wynik[y] = x;
y++;
}
}
if ((document.find.opc_1.checked == false)&&(document.find.opc_2.checked == true))
{
//wyszukiwanie wg tytulow artow
if (dane[x].tytul.toLowerCase().indexOf(haslo) != -1)
{
wynik[y] = x;
y++;
}
}
if ((document.find.opc_1.checked == true)&&(document.find.opc_2.checked == true))
{
//wyszukiwanie wg tytulow artow i autorow
text = dane[x].autor;
text = text.toLowerCase();
text2 = dane[x].tytul;
text2 = text2.toLowerCase();
if ((text.indexOf(haslo) != -1) || (text2.indexOf(haslo) != -1))
{
wynik[y] = x;
y++;
}
}
}
draw_results(wynik);
}
//wyswietla strone zawierajaca wyniki wyszukiwania
bgcol = new Array();
bgcol[1] = "#b2c5ec";
bgcol[3] = "#8ba8e2";
swcol = 1;
function draw_results(tablica)
{
document.clear();
//poczatek
header = '<html><head><title>Action Mag [' + numer_action_maga + '] - wyniki wyszukiwania</title><link rel=stylesheet href="style.css" type="text/css"></head>';
header +='<BODY><a name="gora"><TABLE width=780 border=0 cellpadding=0 cellspacing=0 align=center cols=4><tr><td width=25><td width=184><td width=543><td width=28></tr><tr><td colspan=4 width=780><img src="images/constr/1_top.gif" width="780" height="65" alt="" border="0" usemap="#cda"></td></tr><tr><td colspan=4 width=780><img src="images/constr/2_m_top.gif" width="780" height="37" alt="" border="0" usemap="#menu_top"></td></tr><tr><td width=25 background="images/constr/amag_lft.gif"> </td><td width=184 background="images/constr/3_.gif">';
header +='<td width=543><table border=0 cellspacing=0 cellpadding=1 align=center><tr><td class=title1><table border=0 cellspacing=0 cellpadding=0 align=center><tr><td class=title2> ..:: Wyniki wyszukiwania ::.. </td></table></table>';
header +='<hr noshade color="#658bd9"><br>';
header +='<table width=543 border=0 cellpadding=3 align=center>';
document.write(header);
for (x = 1; x <= (tablica.length-1); x++)
{
swcol = swcol * -1;
bgc = bgcol[2+swcol];
document.write('<tr><td style="background-color: ' + bgc + '"><a id=search href="' + dane[tablica[x]].sciezka + '"> ' + dane[tablica[x]].tytul + '</a></td><td style="background-color: ' + bgc + '"><b>' + dane[tablica[x]].autor + '</b></td></tr>');
}
if (tablica.length == 0)
{
document.write('Nie znaleziono ┐adnych artyku│≤w odpowiadaj╣cych kryteriom wyszukiwania.');
}
//zakonczenie
ending = '</table>';
document.write(ending);
document.write('<br><br><a href="javascript:history.back();"><< Powr≤t do poprzedniej strony</a>');
ending ='</td><td background="images/constr/4_.gif"> </td></tr><tr><td colspan=4 width=780><img src="images/constr/7_design.gif" width="780" height="45" alt="" border="0" usemap="#design"></td></tr></TABLE><map name=cda><area shape=rect coords="681, 24, 780, 64" href="www.cdaction.com.pl"></map><map name=menu_top><area shape=rect coords="79, 2, 151, 16" href="index.htm"><area shape=rect coords="364, 2, 425, 16" onclick="history.go(-1);"><area shape=rect coords="544, 2, 605, 16" onclick="history.go(1);"></map><map name=design><area shape=rect coords="45, 25, 209, 38" href="mailto:mike_b@poczta.fm"><area shape=rect coords="668, 24, 741, 38" href="#gora"></map></BODY></html>';
document.write(ending);
}
function error(opis)
{
alert('-- Action Mag Searching Engine --\n by Glorfindel\n\n BúÑD\n\n' + opis);
}
function random_art(ok)
{
if (ok == 'nie')
{
x = parseInt(Math.random()*(dane.length-1)+1);
alert('"' + dane[x].tytul + '"' + '\n\ by\n' + dane[x].autor);
location.href=dane[x].sciezka;
}
}
//koniec wyszukiwarki
//ROLLOVER
function img_on(obraz)
{
document.images[obraz].src="images/constr/" + obraz+"_on.gif";
}
function img_off(obraz)
{
document.images[obraz].src="images/constr/" + obraz+"_off.gif";
}